package actions;

import java.io.IOException;
import java.util.ResourceBundle;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 
 * @author Philipp Hollenstein
 * @version 10.07.2013
 *  
 */
public abstract class Action {
	
	
	
	public abstract String execute(HttpServletRequest request, HttpSession s) throws Exception;

	
	void saveObjectinSession(HttpServletRequest request, String attributeName, Object object){
		HttpSession s = request.getSession();
		s.setAttribute(attributeName, object);
	}
	
	
	public void setApplicationMessage(HttpSession s, String message){
		s.setAttribute("applicationMessage", message);
	}
	
	protected String getMessageProperty(String keyWord) throws IOException{
		return ResourceBundle.getBundle("properties.messages").getString(keyWord);
	}	
	protected String getForwardProperty(String keyWord) throws IOException{
		return ResourceBundle.getBundle("properties.forward").getString(keyWord);
	}	
	
}
